package cn.Swagger;



import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.*;
import springfox.documentation.spi.DocumentationType;

import springfox.documentation.spring.web.plugins.Docket;


@EnableKnife4j
@Configuration
@EnableOpenApi
//http://localhost:8088/doc.html
public class MySwagger{
    @Bean
    public Docket restApi() {
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                .paths(PathSelectors.any())
                .build();
    }
    //创建该API的基本信息（这些基本信息会展现在文档页面中）
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("测试")
                .description("")
                .termsOfServiceUrl("")
                .contact(new Contact("", "撒旦撒旦撒旦", "2sfsfsf"))
                .build();
    }

}


